﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Text;
using CRM.Entity;

using CRM.BLL;
using DP.Web.UI.Controls;
using DP.Web.UI;
using DP.Common;


namespace CRM.Web.MachineConfigManage
{
    public partial class List : Common.PageBase
    {

        public string ModifyUrl = "Modify.aspx?AUTOID={0}";
        T_MACHINECONFIG_BLL bll = new T_MACHINECONFIG_BLL();
        //SqlServerDAL<T_MACHINECONFIG_Entity> dal = new SqlServerDAL<T_MACHINECONFIG_Entity>();

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            PageHelper.SetPrePageUrl(this.Page);
            //PageHelper.SetPopCalender(this.Page, txtCHASSISREGISTERDATEBegin);
            //PageHelper.SetPopCalender(this.Page, txtCHASSISREGISTERDATEEnd);
            PageHelper.SetPopCalender(this.Page, txtCREATETIMEBegin);
            PageHelper.SetPopCalender(this.Page, txtCREATETIMEEnd);

        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                GetUrlQueryToControl();
                gvDataBinding();
            }
        }

        #region 页面初始化数据绑定




        #endregion

        /// <summary>
        /// 获取 URL 上的参数存入当页面 控件中。
        /// </summary>
        private void GetUrlQueryToControl()
        {
            PageHelper.GetUrlQueryToControl(this.Page);
        }

        /// <summary>
        /// 生成查询条件字符串
        /// </summary>
        private StringBuilder GenerationSQLString()
        {
            StringBuilder sql = new StringBuilder();
            if (!String.IsNullOrEmpty(Request.QueryString["AUTOID"]))
            {
                sql.Append(" and AUTOID like '%" + Request.QueryString["AUTOID"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VINCODE"]))
            {
                sql.Append(" and upper(VINCODE) like '%" + Request.QueryString["VINCODE"].ToUpper() + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CHASSISASSEMBLYMANUFACTURERS"]))
            {
                sql.Append(" and CHASSISASSEMBLYMANUFACTURERS like '%" + Request.QueryString["CHASSISASSEMBLYMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MASTASSEMBLYMANUFACTURERS"]))
            {
                sql.Append(" and MASTASSEMBLYMANUFACTURERS like '%" + Request.QueryString["MASTASSEMBLYMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MASTASSEMBLYNUMBER"]))
            {
                sql.Append(" and MASTASSEMBLYNUMBER like '%" + Request.QueryString["MASTASSEMBLYNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MASTTURNTABLEMANUFACTURERS"]))
            {
                sql.Append(" and MASTTURNTABLEMANUFACTURERS like '%" + Request.QueryString["MASTTURNTABLEMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MASTTURNTABLENUMBER"]))
            {
                sql.Append(" and MASTTURNTABLENUMBER like '%" + Request.QueryString["MASTTURNTABLENUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["BOOMMANUFACTURERS"]))
            {
                sql.Append(" and BOOMMANUFACTURERS like '%" + Request.QueryString["BOOMMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["BOOMNUMBER"]))
            {
                sql.Append(" and BOOMNUMBER like '%" + Request.QueryString["BOOMNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CONNECTIONMANUFACTURERS"]))
            {
                sql.Append(" and CONNECTIONMANUFACTURERS like '%" + Request.QueryString["CONNECTIONMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CONNECTIONNUMBER"]))
            {
                sql.Append(" and CONNECTIONNUMBER like '%" + Request.QueryString["CONNECTIONNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["POWERHEADMANUFACTURERS"]))
            {
                sql.Append(" and POWERHEADMANUFACTURERS like '%" + Request.QueryString["POWERHEADMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["POWERHEADNUMBER"]))
            {
                sql.Append(" and POWERHEADNUMBER like '%" + Request.QueryString["POWERHEADNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MOTORMANUFACTURERS"]))
            {
                sql.Append(" and MOTORMANUFACTURERS like '%" + Request.QueryString["MOTORMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MOTORMODEL"]))
            {
                sql.Append(" and MOTORMODEL like '%" + Request.QueryString["MOTORMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LEFTMOTORNUMBER"]))
            {
                sql.Append(" and LEFTMOTORNUMBER like '%" + Request.QueryString["LEFTMOTORNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["RIGHTMOTORNUMBER"]))
            {
                sql.Append(" and RIGHTMOTORNUMBER like '%" + Request.QueryString["RIGHTMOTORNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["REDUCERMANUFACTURERS"]))
            {
                sql.Append(" and REDUCERMANUFACTURERS like '%" + Request.QueryString["REDUCERMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["REDUCERMODEL"]))
            {
                sql.Append(" and REDUCERMODEL like '%" + Request.QueryString["REDUCERMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LEFTREDUCERNUMBER"]))
            {
                sql.Append(" and LEFTREDUCERNUMBER like '%" + Request.QueryString["LEFTREDUCERNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["RIGHTREDUCERNUMBER"]))
            {
                sql.Append(" and RIGHTREDUCERNUMBER like '%" + Request.QueryString["RIGHTREDUCERNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MAINHOISTMANUFACTURERS"]))
            {
                sql.Append(" and MAINHOISTMANUFACTURERS like '%" + Request.QueryString["MAINHOISTMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MAINHOISTMODEL"]))
            {
                sql.Append(" and MAINHOISTMODEL like '%" + Request.QueryString["MAINHOISTMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MAINHOISTNUMBER"]))
            {
                sql.Append(" and MAINHOISTNUMBER like '%" + Request.QueryString["MAINHOISTNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["AUXILIARYHOISTMANUFACTURERS"]))
            {
                sql.Append(" and AUXILIARYHOISTMANUFACTURERS like '%" + Request.QueryString["AUXILIARYHOISTMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["AUXILIARYHOISTMODEL"]))
            {
                sql.Append(" and AUXILIARYHOISTMODEL like '%" + Request.QueryString["AUXILIARYHOISTMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["AUXILIARYHOISTNUMBER"]))
            {
                sql.Append(" and AUXILIARYHOISTNUMBER like '%" + Request.QueryString["AUXILIARYHOISTNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MAINREDUCERMANUFACTURERS"]))
            {
                sql.Append(" and MAINREDUCERMANUFACTURERS like '%" + Request.QueryString["MAINREDUCERMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MAINREDUCERMODEL"]))
            {
                sql.Append(" and MAINREDUCERMODEL like '%" + Request.QueryString["MAINREDUCERMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MAINREDUCERNUMBER"]))
            {
                sql.Append(" and MAINREDUCERNUMBER like '%" + Request.QueryString["MAINREDUCERNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["AUXILIARYREDUCERMANUFACTURERS"]))
            {
                sql.Append(" and AUXILIARYREDUCERMANUFACTURERS like '%" + Request.QueryString["AUXILIARYREDUCERMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["AUXILIARYREDUCERMODEL"]))
            {
                sql.Append(" and AUXILIARYREDUCERMODEL like '%" + Request.QueryString["AUXILIARYREDUCERMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["AUXILIARYREDUCERNUMBER"]))
            {
                sql.Append(" and AUXILIARYREDUCERNUMBER like '%" + Request.QueryString["AUXILIARYREDUCERNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PRESSURECYLINDERMANUFACTURERS"]))
            {
                sql.Append(" and PRESSURECYLINDERMANUFACTURERS like '%" + Request.QueryString["PRESSURECYLINDERMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PRESSURECYLINDERMODEL"]))
            {
                sql.Append(" and PRESSURECYLINDERMODEL like '%" + Request.QueryString["PRESSURECYLINDERMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PRESSURECYLINDERNUMBER"]))
            {
                sql.Append(" and PRESSURECYLINDERNUMBER like '%" + Request.QueryString["PRESSURECYLINDERNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MASTCYLINDERMANUFACTURERS"]))
            {
                sql.Append(" and MASTCYLINDERMANUFACTURERS like '%" + Request.QueryString["MASTCYLINDERMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MASTCYLINDERMODEL"]))
            {
                sql.Append(" and MASTCYLINDERMODEL like '%" + Request.QueryString["MASTCYLINDERMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LEFTMASTCYLINDERNUMBER"]))
            {
                sql.Append(" and LEFTMASTCYLINDERNUMBER like '%" + Request.QueryString["LEFTMASTCYLINDERNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["RIGHTMASTCYLINDERNUMBER"]))
            {
                sql.Append(" and RIGHTMASTCYLINDERNUMBER like '%" + Request.QueryString["RIGHTMASTCYLINDERNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CHANGECYLINDERMANUFACTURERS"]))
            {
                sql.Append(" and CHANGECYLINDERMANUFACTURERS like '%" + Request.QueryString["CHANGECYLINDERMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CHANGECYLINDERMODEL"]))
            {
                sql.Append(" and CHANGECYLINDERMODEL like '%" + Request.QueryString["CHANGECYLINDERMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LEFTCHANGECYLINDERNUMBER"]))
            {
                sql.Append(" and LEFTCHANGECYLINDERNUMBER like '%" + Request.QueryString["LEFTCHANGECYLINDERNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["RIGHTCHANGECYLINDERNUMBER"]))
            {
                sql.Append(" and RIGHTCHANGECYLINDERNUMBER like '%" + Request.QueryString["RIGHTCHANGECYLINDERNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["M4VALUEMANUFACTURERS"]))
            {
                sql.Append(" and M4VALUEMANUFACTURERS like '%" + Request.QueryString["M4VALUEMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["M4VALUENUMBER"]))
            {
                sql.Append(" and M4VALUENUMBER like '%" + Request.QueryString["M4VALUENUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["FOLLOWFRAMEMANUFACTURERS"]))
            {
                sql.Append(" and FOLLOWFRAMEMANUFACTURERS like '%" + Request.QueryString["FOLLOWFRAMEMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["FOLLOWFRAMENUMBER"]))
            {
                sql.Append(" and FOLLOWFRAMENUMBER like '%" + Request.QueryString["FOLLOWFRAMENUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["SLEWINGRINGMANUFACTURERS"]))
            {
                sql.Append(" and SLEWINGRINGMANUFACTURERS like '%" + Request.QueryString["SLEWINGRINGMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["SLEWINGRINGNUMBER"]))
            {
                sql.Append(" and SLEWINGRINGNUMBER like '%" + Request.QueryString["SLEWINGRINGNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["DRILLMANUFACTURERS"]))
            {
                sql.Append(" and DRILLMANUFACTURERS like '%" + Request.QueryString["DRILLMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["DRILLMODEL"]))
            {
                sql.Append(" and DRILLMODEL like '%" + Request.QueryString["DRILLMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["DRILLNUMBER"]))
            {
                sql.Append(" and DRILLNUMBER like '%" + Request.QueryString["DRILLNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["INTRODUCTIONMANUFACTURERS"]))
            {
                sql.Append(" and INTRODUCTIONMANUFACTURERS like '%" + Request.QueryString["INTRODUCTIONMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["INTRODUCTIONNUMBER"]))
            {
                sql.Append(" and INTRODUCTIONNUMBER like '%" + Request.QueryString["INTRODUCTIONNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CONTROLLERMANUFACTURERS"]))
            {
                sql.Append(" and CONTROLLERMANUFACTURERS like '%" + Request.QueryString["CONTROLLERMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CONTROLLERMODEL"]))
            {
                sql.Append(" and CONTROLLERMODEL like '%" + Request.QueryString["CONTROLLERMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ZEROCONTROLLERNUMBER"]))
            {
                sql.Append(" and ZEROCONTROLLERNUMBER like '%" + Request.QueryString["ZEROCONTROLLERNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ONECONTROLLERNUMBER"]))
            {
                sql.Append(" and ONECONTROLLERNUMBER like '%" + Request.QueryString["ONECONTROLLERNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MONITORMANUFACTURERS"]))
            {
                sql.Append(" and MONITORMANUFACTURERS like '%" + Request.QueryString["MONITORMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MONITORMODEL"]))
            {
                sql.Append(" and MONITORMODEL like '%" + Request.QueryString["MONITORMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MONITORNUMBER"]))
            {
                sql.Append(" and MONITORNUMBER like '%" + Request.QueryString["MONITORNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LEVELINGSENSORMANUFACTURERS"]))
            {
                sql.Append(" and LEVELINGSENSORMANUFACTURERS like '%" + Request.QueryString["LEVELINGSENSORMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LEVELINGSENSORMODEL"]))
            {
                sql.Append(" and LEVELINGSENSORMODEL like '%" + Request.QueryString["LEVELINGSENSORMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LEVELINGSENSORNUMBER"]))
            {
                sql.Append(" and LEVELINGSENSORNUMBER like '%" + Request.QueryString["LEVELINGSENSORNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ANGULARSENSORMANUFACTURERS"]))
            {
                sql.Append(" and ANGULARSENSORMANUFACTURERS like '%" + Request.QueryString["ANGULARSENSORMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ANGULARSENSORMODEL"]))
            {
                sql.Append(" and ANGULARSENSORMODEL like '%" + Request.QueryString["ANGULARSENSORMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ANGULARSENSORNUMBER"]))
            {
                sql.Append(" and ANGULARSENSORNUMBER like '%" + Request.QueryString["ANGULARSENSORNUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CHASSISREGISTERDATEBegin"]))
            {
                sql.Append(" and " + bll._dal.GetBeginDateString("CHASSISREGISTERDATE", Request.QueryString["CHASSISREGISTERDATEBegin"].Trim()) + " ");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CHASSISREGISTERDATEEnd"]))
            {
                sql.Append(" and " + bll._dal.GetBeginDateString("CHASSISREGISTERDATE", Request.QueryString["CHASSISREGISTERDATEEnd"].Trim()) + " ");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["REMARK"]))
            {
                sql.Append(" and REMARK like '%" + Request.QueryString["REMARK"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["DEPARTMENTID"]))
            {
                sql.Append(" and DEPARTMENTID = '" + Request.QueryString["DEPARTMENTID"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["DEPARTMENTNAME"]))
            {
                sql.Append(" and DEPARTMENTNAME like '%" + Request.QueryString["DEPARTMENTNAME"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["DEPARTMENTCODE"]))
            {
                sql.Append(" and DEPARTMENTCODE like '%" + Request.QueryString["DEPARTMENTCODE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CREATETIMEBegin"]))
            {
                sql.Append(" and " + bll._dal.GetBeginDateString("CREATETIME", Request.QueryString["CREATETIMEBegin"].Trim()) + " ");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CREATETIMEEnd"]))
            {
                sql.Append(" and " + bll._dal.GetBeginDateString("CREATETIME", Request.QueryString["CREATETIMEEnd"].Trim()) + " ");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CREATEPEOPLEID"]))
            {
                sql.Append(" and CREATEPEOPLEID = '" + Request.QueryString["CREATEPEOPLEID"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CREATEPEOPLE"]))
            {
                sql.Append(" and CREATEPEOPLE like '%" + Request.QueryString["CREATEPEOPLE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LASTMODIFYPEOPLEID"]))
            {
                sql.Append(" and LASTMODIFYPEOPLEID = '" + Request.QueryString["LASTMODIFYPEOPLEID"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LASTMODIFYPEOPLE"]))
            {
                sql.Append(" and LASTMODIFYPEOPLE like '%" + Request.QueryString["LASTMODIFYPEOPLE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LASTMODIFYTIMEBegin"]))
            {
                sql.Append(" and " + bll._dal.GetBeginDateString("LASTMODIFYTIME", Request.QueryString["LASTMODIFYTIMEBegin"].Trim()) + " ");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LASTMODIFYTIMEEnd"]))
            {
                sql.Append(" and " + bll._dal.GetBeginDateString("LASTMODIFYTIME", Request.QueryString["LASTMODIFYTIMEEnd"].Trim()) + " ");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["BUSINESSDIVISIONID"]))
            {
                sql.Append(" and BUSINESSDIVISIONID = '" + Request.QueryString["BUSINESSDIVISIONID"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["BUSINESSDIVISIONNAME"]))
            {
                sql.Append(" and BUSINESSDIVISIONNAME like '%" + Request.QueryString["BUSINESSDIVISIONNAME"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["BUSINESSDIVISIONCODE"]))
            {
                sql.Append(" and BUSINESSDIVISIONCODE like '%" + Request.QueryString["BUSINESSDIVISIONCODE"] + "%'");
            }

            return sql;

        }

        /// <summary>
        /// 页面数据绑定
        /// </summary>
        private void gvDataBinding()
        {
            #region 查询条件字符串
            StringBuilder sql = GenerationSQLString();
            #endregion

            List<T_MACHINECONFIG_Entity> list;

            //获取总的记录条数
            gvList.RecordCount = (int)bll.GetCount(sql.ToString());

            list = bll.GetList(sql.ToString(), gvList.CurrentPageIndex * gvList.PageSize, gvList.PageSize, gvList.SortConditions);

            gvList.DataSource = list;
            gvList.DataKeyNames = new string[] { "AUTOID" };
            gvList.DataBind();

        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string url = HttpContext.Current.Request.Url.AbsolutePath;
            PageHelper.GetControlToUrlQuery(this.Page, ref url);
            Response.Redirect(url);
        }

        #region GridView 事件
        /// <summary>
        /// GridView 删除事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            T_MACHINECONFIG_Entity entity = new T_MACHINECONFIG_Entity();
            entity.AUTOID = StringHelper.ToInt((sender as GridView).DataKeys[e.RowIndex].Values[0].ToString());

            long rel = bll.Delete(entity);
            if (rel > 0)
            {
                Response.Redirect(HttpContext.Current.Request.RawUrl);
            }
            else
            {

            }

        }

        /// <summary>
        /// GridView 行数据绑定事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
                case DataControlRowType.DataRow:
                    {
                        GridView gv = (sender as GridView);
                        for (int i = 0; i < gv.Columns.Count; i++)
                        {
                            TemplateField tf = gv.Columns[i] as TemplateField;
                            if (tf != null)
                            {
                                #region 存储值 转换成  显示值
                                switch (tf.HeaderText)
                                {
                                    case "操作":
                                        {
                                            e.Row.Cells[i].Attributes.Add("style", "white-space: nowrap;");
                                        }
                                        break;
                                    default:
                                        {
                                            e.Row.Cells[i].Attributes.Add("style", "white-space: nowrap;");
                                        }
                                        break;

                                }
                                #endregion
                            }

                            BoundField bf = gv.Columns[i] as BoundField;
                            if (bf != null)
                            {
                                #region 存储值 转换成  显示值
                                switch (bf.DataField)
                                {
                                    default:
                                        {

                                        }
                                        break;
                                }
                                #endregion
                            }
                        }
                    }
                    break;
                case DataControlRowType.Header:
                    {

                    }
                    break;
                case DataControlRowType.Pager:
                    {

                    }
                    break;
                case DataControlRowType.EmptyDataRow:
                    {


                    }
                    break;
                default:

                    break;
            }

        }

        /// <summary>
        /// GridView 行创建事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvList_RowCreated(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
                case DataControlRowType.DataRow:
                    {

                    }
                    break;
                case DataControlRowType.Header:
                    {

                    }
                    break;
                case DataControlRowType.Pager:
                    {

                    }
                    break;
                case DataControlRowType.EmptyDataRow:
                    {


                    }
                    break;
                default:

                    break;
            }

        }
        #endregion
    }
}
